<?php
	$conn = mysql_connect("localhost","root","1234") or die(mysql_error());
	$db = mysql_select_db("book_db") or die("Cannot select db");
	mysql_query("SET character_set_results=tis620");
    mysql_query("SET character_set_client=tis620");
    mysql_query("SET character_set_connection=tis620");
	mysql_query("SET NAMES windows");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>รายชื่อสำนักพิมพ์</title>
<? 
$_SESSION["PubID"] =  $result["PubID"];
 $result = mysql_query("SELECT * FROM publisher WHERE PubID = '".$_POST['id']."'");
 if($_POST[search]){
 $result = mysql_query("SELECT * FROM publisher  WHERE  PubID LIKE '$_POST[keyword]' " );
}else{
 $result = mysql_query("SELECT *  FROM publisher");
}
?>
<style type="text/css">
body {
	background-color: #82AFFB;
}
</style>
</head>

<body>
<table width="855" height="522" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="133" colspan="8"><img src="../image/mix.jpg" width="840" height="195" /></td>
  </tr>
  <tr>
    <td width="144" height="52"><a href="file:///G|/pppppppppppppppppppppppppp/bok/add_officer.php"><img src="../image/menuadmin1.jpg" width="140" height="40" /></a></td>
    <td width="144"><a href="file:///G|/pppppppppppppppppppppppppp/bok/add_members.php"><img src="../image/menuadmin2.jpg" width="140" height="40" /></a></td>
    <td width="144"><a href="file:///G|/pppppppppppppppppppppppppp/bok/Addbook.html"><img src="../image/menuadmin3.jpg" width="140" height="40" /></a></td>
    <td width="144"><a href="file:///G|/pppppppppppppppppppppppppp/bok/add_pub.php"><img src="../image/menuadmin4.jpg" width="140" height="40" /></a></td>
    <td width="140"><img src="../image/menuadmin5.jpg" width="140" height="40" /></td>
    <td width="140"><img src="../image/menuadmin8.jpg" width="140" height="40" /></td>
  </tr>
  <tr>
    <td colspan="8"><form id="form1" name="form1" method="post" action="">
      <p><center> 
        <p>แสดงรายชื่อสำนักพิมพ์ทั้งหมด </p>
        <p><a href="file:///G|/pppppppppppppppppppppppppp/bok/add_pub.php">เพิ่มข้อมูลสำนักพิมพ์</a></p>
        </center></p>
      <table width="613" height="101" border="1" align="center">
        <tr>
          <center><td width="183" height="33" bgcolor="#FFFFFF"><h4>รหัสสำนักพิมพ์</h4></td></center>
          <center><td width="244" bgcolor="#FFFFFF"><h4>ชื่อสำนักพิมพ์</h4></td></center>
          <center><td width="79" bgcolor="#FFFFFF"><h4>แก้ไขข้อมูล</h4></td></center>
          <center><td width="79" bgcolor="#FFFFFF"><h4>ลบข้อมูล</h4></td></center>
          <? 
   $rows = mysql_num_rows($result);
   if($rows > 0){
   for ($i=0;$i<$rows; $i++){
     mysql_data_seek($result,$i);
         $data[$i] = mysql_fetch_array($result)
 ?>
          <tr>
            <td align="center"><? echo  $data[$i]['PubID'] ?>&nbsp;</td>
            <td align="center"><? echo $data[$i]['PubName']; ?>&nbsp;</td>
            <td align="center"><a href="edit_pub.php?PubID=<?=$data[$i]["PubID"];?>">แก้ไขข้อมูล</a></td>
            <td align="center"><a href="JavaScript:if(confirm('Confirm Delete?')==true){window.location='delete_pub.php?PubID=<?php echo $data[$i]["PubID"];?>';}">ลบข้อมูล</a></td>
          </tr>
        <? 
   }  // end for
 }  // end if rows > 0
 ?>
        </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </form></td>
  </tr>
</table>
</body>
</html>